<template>
    <div class="box">
        <el-input
                v-model="advise.context"
                :autosize="true"
                maxlength="230"
                placeholder="请提交您的建议"
                show-word-limit
                type="textarea"
        />
        <div class="btnBox">

            <el-button class="btn" @click="submit">提交</el-button>
        </div>
    </div>

</template>

<script lang='ts' setup>
import { ref } from 'vue'
import { Advise } from '@/ts/type'
import { AdviseService } from '@/api'
import { Notification } from '@/plugins/element'

const advise = ref<Advise>({})
const submit = () => {
  AdviseService.postAdvises(advise.value).then(res => {
    const { data } = res
    Notification.success(data)
    advise.value.context = ''
  })
}
</script>

<style lang='scss' scoped>
.box {
  height: 210px;
}

:deep(.el-textarea__inner) {
  height: 130px !important;
}

.btnBox {
  margin-top: 20px;
  display: flex;

  .btn {
    margin: auto;
  }
}
</style>